import { http } from "@/uni-sub-base/service/request.js"
import { getBaseUrl } from "@/utils/appUrls.js"
let serviceName = "Member/"
const baseURL = `${getBaseUrl()}Member/`

//会员登录
export function UserLogin(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "UserLogin",
        data,
    })
}
//获取会员购物车
export function getUserCarList(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "getUserCarList",
        data,
    })
}
//获取会员收货地址列表
export function getReceivingAddressList(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "getReceivingAddressList",
        data,
    })
}
//编辑收货地址
export function userAddressAddOrEdit(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "userAddressAddOrEdit",
        data,
    })
}
//删除收货地址
export function userAddressDelete(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "userAddressDelete",
        data,
    })
}
//获取区域控件获取列表
export function GetCountrywideListBySelRegion(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "getCountrywideListBySelRegion?parentId=" + data.parentId,
        data,
    })
}
//识别地址
export function batchSmartParse(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "batchSmartParse",
        data,
    })
}
//收藏
export function addProductToFavorite(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "addProductToFavorite",
        data,
    })
}
//加入购物车
export function addOrUpdateAmount(data, path) {
    return http.post({
        url: getBaseUrl() + serviceName + "addOrUpdateAmount" + (path ? path : "?orderType=-1"),
        data,
    })
}
//加入购物车
export function addOrEditUserCarList(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "addOrEditUserCarList",
        data,
    })
}
//删除、清空 购物车
export function deleteUserCar(data, orderType, warehouseId) {
    return http.post({
        url:
            getBaseUrl() + serviceName +
            "deleteUserCar?ids=" +
            data.ids +
            "&orderType=" +
            (orderType ? orderType : "-1") +
            "&warehouseId=" +
            warehouseId,
        data,
    })
}
//获取要结算的订单信息
export function getSubmitOrderData(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "getSubmitOrderData",
        data,
    })
}
//获取要结算的订单信息
export function getMemberCenterInfo(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "getMemberCenterInfo",
        data,
    })
}
//再次购买
export function BuyAgain(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "BuyAgain?orderId=" + data.orderId + "&warehouseId=" + (data.warehouseId ? data.warehouseId : 0),
        data,
    })
}

//获取要结算的订单信息
export function getMemberDetail(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "getMemberDetail",
        data,
    })
}
//获取我的财务
export function getAccountBalance(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "getAccountBalance",
        data,
    })
}
//获取个人信息
export function GetMemberDetail(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetMemberDetail",
        data,
    })
}
//保存个人信息
export function SubmitMemberDetail(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "SubmitMemberDetail",
        data,
    })
}
//修改密码
export function ChangePwd(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "ChangePwd" + path,
    })
}

//修改密码
export function addTempCar(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "SubmitMemberDetail",
        data,
    })
}

//充值提交
export function ApplyRecharge(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "ApplyRecharge",
        data,
    })
}

export function GetInitRechargeDetail(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetInitRechargeDetail",
        data,
    })
}

//充值记录列表
export function GetUserMoneyLogList(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetUserMoneyLogList",
        data,
    })
}
//提交凭证
export function submitVoucher(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "submitVoucher",
        data,
    })
}
//充值明细-返点明细 余额
export function GetUerBalanceByMoneyType(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetUerBalanceByMoneyType" + path,
    })
}
//充值明细-返点明细
export function GetWholeSaleMoneyList(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetWholeSaleMoneyList",
        data,
    })
}
//校验是否已注册
export function judgeIsExist(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "JudgeIsExist?username=" + data,
        data: {},
    })
}
//获取运费费用信息
export function StatisPostageMoneyByUserCar(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "StatisPostageMoneyByUserCar",
        data,
    })
}
//获取运费费用信息
export function GetStatisPostageMoney(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetStatisPostageMoney",
        data,
    })
}
//获取商户退货地址
export function GetReturnAddress(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetReturnAddress",
        data,
    })
}

//获取VIP套餐列表
export function GetAllVipCard(data = {}) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetAllVipCard",
        data,
    })
}

//购买VIP支付成功回调
export function PayVipCallBack(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "PayVipCallBack",
        data,
    })
}

//提交购买vip预订单信息
export function SubmitVipInfo(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "SubmitVipInfo",
        data,
    })
}

//Vip线下支付-余额支付
export function VipXianPay(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "VipXianPay",
        data,
    })
}

//添加或更新临时购物车
export function AddOrUpdateTempAmount(data, path = "") {
    return http.post({
        url: getBaseUrl() + serviceName + "AddOrUpdateTempAmount" + path,
        data,
    })
}

//获取购买会员记录
export function GetVipBuyRecordFromClient(data, path = "") {
    return http.post({
        url: getBaseUrl() + serviceName + "GetVipBuyRecordFromClient" + path,
        data,
    })
}
//短信登录
export function QuickLogin(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "QuickLogin" + path,
    })
}
//获取短信验证码
export function SendSmsNoVerifyCode(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "SendSmsNoVerifyCode" + path,
    })
}
//忘记密码
export function ReSetPwd(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "ReSetPwd" + path,
    })
}
//是否开启短信
export function GetSms() {
    return http.post({
        url: getBaseUrl() + serviceName + "GetSms",
    })
}

export function GetLoginWay() {
    return http.post({
        url: getBaseUrl() + serviceName + "GetLoginWay",
    })
}
//是否设置支付密码
export function IsSetPayPassword() {
    return http.post({
        url: getBaseUrl() + serviceName + "IsSetPayPassword",
    })
}
// 设置支付密码
export function SetPayPassword(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "SetPayPassword",
        data,
    })
}
//重置支付密码
export function ResetPayPassword(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "ResetPayPassword",
        data,
    })
}
//验证支付密码
export function CheckPayPassword(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "CheckPayPassword",
        data,
    })
}
//切换用户
export function GetUserLoginList(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetUserLoginList" + path,
    })
}
//切换登录用户
export function SwitchUserLogin(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "SwitchUserLogin" + path,
    })
}
//等级列表
export function GetApplyUpgradeInfo() {
    return http.get({
        url: getBaseUrl() + serviceName + "GetApplyUpgradeInfo",
    })
}
//提交升级申请
export function ApplyUpgrade(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "ApplyUpgrade",
        data,
    })
}
//获取会员所属地区
export function GetUserRegion(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetUserRegion",
        data,
    })
}
//更新会员所属地区
export function UpdateUserRegion(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "UpdateUserRegion",
        data,
    })
}
export function UserAddressSetDefault(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "UserAddressSetDefault" + path,
    })
}
// 获取微信手机号
export function GetMiniAppWXPhone(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetMiniAppWXPhone",
        data,
    })
}
//获取区域子公司列表
export function GetDisList(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetDisList",
        data,
    })
}
// 登录用户是否是主账号
export function IsMainAccount() {
    return http.post({
        url: getBaseUrl() + serviceName + "IsMain",
    })
}
//获取登录子账号列表
export function GetUserLoginAccountList(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetUserLoginAccountList",
        data,
    })
}
//添加登录子账号
export function AddUserLoginAccount(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "AddUserLoginAccount",
        data,
    })
}
//修改登录子账号
export function EditUserLoginAccount(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "EditUserLoginAccount",
        data,
    })
}
//删除登录子账号
export function DeleteUserLoginAccount(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "DeleteUserLoginAccount",
        data,
    })
}

export function GetAccountStatus() {
    return http.post({
        url: getBaseUrl() + serviceName + "GetAccountStatus",
    })
}

//获取会员等级信息
export function GetMemberGradeInfo() {
    return http.post({
        url: getBaseUrl() + serviceName + "GetMemberGradeInfo",
    })
}
//是否需要绑定信息
export function GetBindingInfo() {
    return http.post({
        url: getBaseUrl() + serviceName + "GetBindingInfo",
    })
}
//提交绑定信息
export function SubmitBinding(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "SubmitBinding?type=0",
		data
    })
}
export function GetCreditLimit(path) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetCreditLimit"+path
    })
}

// 店铺中心会员列表
export function GetInvitUserByPage(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetInvitUserByPage",
		data
    })
}

// 店铺中心会员列表
export function GetInvitUserByList(data) {
    return http.post({
        url: getBaseUrl() + serviceName + "GetInvitUserByList",
		data
    })
}

// 获取用户协议/隐私政策
export function GetInfoByType(type) {
    return http.post({
        url: getBaseUrl() + "Agreement/GetInfoByType?agreementType=" + type,
    })
}